<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="header.html"}>
	<title>科目管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
</head>
<body>
<div class="wrap">
	<!--star left-->
	<div class="column">
		<{include file="left_menu.html"}>
	</div>
	<div id="ContMianBox">
		<!--star子栏目-->
		<div class="sub-colum">
            <div class="tit">库存管理</div>
            <ul>
                <li><a href="/shelves">系统网课</a></li>
                <li class="curr"><a href="/subject/system">系统题库</a></li>
                <li><a href="/shixun">实训库存</a></li>
            </ul>
        </div>
		<!--end子栏目-->
		<!--end left-->
		<div class="container narrow">
		    <!--star conter-->
		    <div class="cetContent">
				<div class="tit p-lr20">
				    <span class="curr">科目管理</span>
				    <span><a href="/subject/chapter_list">章节管理</a></span>
				</div>
				<!--star内容区域-->
				<div class="mainScroll">
				    <div class="mainContainer line-all">
				        <!--star tabMainCont-->
				        <div class="tabMainCont">
				            <!--star会员管理-->
							<fieldset class="layui-elem-field">
								<legend>按条件搜索</legend>
								<div class="layui-field-box">
									<form class="layui-form layui-form-pane1" method="post" action="<{$current_url}>">
										<div class="layui-form-item">
											<div class="layui-inline">
												<input type="text" name="title" placeholder="科目名称" value="<{if !empty($conditions['title']) }><{$conditions['title']}><{/if}>" class="layui-input">
											</div>

											<div class="layui-inline">
												<select name="tk_category_id">
													<option value="0">按分类筛选</option>
													<{foreach from=$category_list item=citem}>
													<option value="<{$citem.id}>" <{if isset($conditions.tk_category_id) AND $conditions.tk_category_id == $citem.id}>selected<{/if}>><{$citem.name}></option>
													<{/foreach}>
												</select>
											</div>

											<div class="layui-inline">
												<select name="pack_status">
													<option>上架状态</option>
													<option value="1" <{if isset($conditions.pack_status) AND $conditions.pack_status == 1}>selected<{/if}>>上架</option>
													<option value="2" <{if isset($conditions.pack_status) AND $conditions.pack_status == 2}>selected<{/if}>>未上架</option>
												</select>
											</div>
											
											<div class="layui-inline">
												<button type="submit" class="layui-btn">搜索</button>
												
											</div>
										</div>
									</form>
								</div>
							</fieldset>
		                	<form class="layui-form layui-form-pane1" method="post" delete_action="/subject/delete">
								<table class="layui-table" lay-even lay-skin="row">
								  	<thead>
									  	<tr>
										  	<tr>
												<th>科目名称</th>
												<th>分类名称</th>
												<th>上架价格</th>
                                                <th>佣金比例</th>
                                                <th>有效天数</th>
												<th>激活码(已使用/总数/冻结数)</th>
												<th>上架时间</th>
												<th>操作</th>
											</tr>
									  	</tr>
								  	</thead>
								  	<tbody>
								  	<{foreach from=$subject_list item=item}>
										<tr>
											<td class="center"><a style="font-weight: bold;" href="/subject/chapter_list/<{$item.id}>"><{$item['title']}></a></td>
											<td class="center"><{$item['name']}></td>
											<td class="not_lb tal"><span class="c-ff6d5e"><{if isset($item.price)}>¥<{$item.price}>元<{/if}></span></td>
                                            <td class="not_lb tal"><span class="c-ff6d5e"><{if isset($item.commission)}><{$item.commission}>%<{/if}></span></td>
                                            <td class="not_lb tal"><span class="c-ff6d5e"><{if isset($item.commission)}><{$item.expire_day}>天<{/if}></span></td>
											<td class="center"><{$item['use_code']}>/<{$item['use_code']+$item['no_use_code']}>/<{$item.dongjie}></td>
											<td class="not_lb tal"><{$item[ 'on_time']|date_format: '%Y-%m-%d <br> %H:%M:%S'}></td>
											<td class="center">
												<div class="colorBtn">
												
												<{if $item.status == 0}>
												<p><a class="up" subject_id="<{$item['id']}>" pack_id="<{$item.pack_id}>" href="javascript:;">上架</a></p>
												<{else}>
												<p><a class="down" subject_id="<{$item['id']}>" pack_id="<{$item.pack_id}>" href="javascript:;">已上架</a></p>
												<p><a class="up" subject_id="<{$item['id']}>" pack_id="<{$item.pack_id}>" href="javascript:;">修改上架信息</a></p>
												<{/if}>
												<{if $item['school_id'] == 0}>
												<p><a class="" href="/shelves/shouquan/<{$item.id}>/4">申请授权码</a></p>

												<p><a class="show_system_topic" url="/order_course_auth/school_order_records/<{$item.id}>/4" href="javascript:;">查看授权码</a></p>
												<{/if}>
												</div>
											</td>
										</tr>
									<{/foreach}>
								  	<{if $subject_list|count eq 0}>
								  		<tr>
									  		<td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
												赞无数据！
											</td>
									  	</tr>
								  	<{/if}>
							  		</tbody>
							  	</table>
						  	</form>
			                <div class="pages p-tb20" style="text-align:right;">
			                    <{$pagination}>
			                </div>
			            </div>
			            <!--star会员管理-->
			        </div>
				        <!--end tabMainCont-->
		        </div>
		    </div>
		</div>
	</div>
</div>
<{include file="footer.html"}>
<script type="text/javascript">
	$(".up").click(function(){
		layer.open({
			type: 2,
			title: '科目上架',
			shadeClose: true,
			shade: 0.8,
			area: ['500px', '340px'],
			maxmin: true,
			content: '/subject/shelves/'+$(this).attr("subject_id")+'/'+$(this).attr("pack_id") //iframe的url
		});
	})

	$(".down").click(function(){
		$.ajax({
			type: "POST",
			url: "/subject/shelves_down/" + $(this).attr("pack_id"),
			dataType:"json",
			async:false,
			data:{'subject_id':$(this).attr("subject_id"),'pack_id':$(this).attr("pack_id")},
			contentType:'application/x-www-form-urlencoded',
			success: function(result){
				if(result.code == 1){
					layer.msg('已下架', {
				        icon: 1,
				        shade:0.5,
				        time: 2000 //2秒关闭（如果不配置，默认是3秒）
				    });
				}
			}
		});
	})

	$(".show_system_topic").click(function(){
        layer.open({
            type: 2,
            title: '激活码列表',
            shadeClose: true,
            shade: 0.8,
            area: ['90%', '90%'],
            maxmin: true,
            content: $(this).attr("url") //iframe的url
        }); 
    })
</script>
</body>
</html>